<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="base.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>BBS-个人中心</title>
		<link rel="stylesheet" type="text/css" href="style/style.css" />
		<style type="text/css" >
			span{
				display:none;
			}
		</style>
		<script type="text/javascript" src="${basePath }/script/jquery-1.3.2.min.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#modifyForm").submit(function(){
					if($.trim($("#mail").val()) == null || !$.trim($("#mail").val()).match(/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/)){
					 	$(".mailmsg").css("display","block");
					 	return false;
					}
					if($.trim($("#sign").val()) == null){
					 	$(".signmsg").css("display","block");
					 	return false;
					}
					if($.trim($("#pic").val()) == null){
					 	$(".picmsg").css("display","block");
					 	return false;
					}
					if($.trim($("#tel").val()) == null || !$.trim($("#tel").val()).match(/^0*(13|15)\d{9}$/)){
					 	$(".telmsg").css("display","block");
					 	return false;
					}
					return true;
				});
			});
		</script>
	</head>

	<body>
		<%@include file="template/top.jsp"%>

		<div id="contain">
		<div class="nav">
    	<a href="index.jspx">论坛首页</a>
        &gt;&gt;
       个人中心
  </div>	
			<div class="board">
				<div class="board_title">
					个人中心
				</div>
				<div class="reg_login">
					<div class="left">
						<c:if test="${not empty msg }">
							<div class="error" style="width: 300px;">
								${msg }
							</div>
							<c:remove var="msg" scope="session" />
						</c:if>
						<form action="user.jspx" method="post" id="modifyForm" enctype="multipart/form-data">
							<input type="hidden" name="id" value="${sessionScope.user.id }"/>
							<label>
								用户名：
							</label>
							${sessionScope.user.name }
							<label>
								电子邮件：
							</label>
							<input type="text" name="email" id="mail" class="text" value="${sessionScope.user.email }"/>
							<span class="mailmsg">请填写有效的邮箱地址</span>
							<label>
								性别：
							</label>
							<input type="radio" name="sex" value="1" checked="checked"/>
							男
							<input type="radio" name="sex" value="0" />
							女
							<br />
							<label>
								电话：
							</label>
							<input type="text" name="tel" id="tel" value="${sessionScope.user.tel }"/>
							<span class="telmsg">支持130-139，150-159号码段</span>
							<label>
								个性签名：
							</label>
							<textarea name="sign" id="sign">
								${sessionScope.user.sign }
							</textarea>
							<span class="signmsg">个性签名不能为空</span>
							<label>
								头像：
							</label>
							<input type="file" name="pic" id="pic" size="20"/>
							<span class="pic">请选择头像</span>
							<div>
								<input type="submit" value="保存" />
								
							</div>
						</form>
					</div>
					<div class="right">
						<a href="user.jspx?_method=tomodify">修改密码</a>
						<h3>
							原始头像
						</h3>
						<img src = "${basePath }/upload/${sessionScope.user.pic}"/>
					</div>
				</div>
			</div>
		</div>

		<%@include file="template/footer.jsp"%>

	</body>
</html>
